# 读取文件
# open 打开文件
# read 读取文件内容
# 文件相对路径、绝对路径
# 逐行读取
# readlines 读取后赋值，文件只能在 with语言内使用，赋值后可在其他地方使用

with open('pi_digits.txt') as file_object:
    contents = file_object.read()
    print(type(contents.rstrip()))
    print(contents.rstrip())

# 逐行读取
filename = 'pi_digits.txt'
with open(filename) as file_object:
    for line in file_object:
        # print(line)
        print(line.rstrip())

print('file_object', type(file_object))

with open(filename) as file_object:
    lines = file_object.readlines()

print('lines', lines)
pi_string = ''
for line in lines:
    print(line.rstrip())
    pi_string += line.strip()

print('pi_string', pi_string)

birthday = input('Enter your birthday, in the form mmddyy:')
if birthday in pi_string:
    print('your birthday apperars in the firsh million digits of pi!')
else:
    print('not appear in the firth million digits of pi.')

